﻿namespace TroubleshootingofBeanBagAssistant.lCheck
{
	public class DiskSpaceCheck : IDiagnosticCheck
	{
		public string Name => "磁盘空间检查";

		public CheckResult Run()
		{
			// 检查C盘剩余空间
			long freeSpace = DiskSpaceHelper.GetFreeDiskSpace(@"C:\");
			// 10GB = 10 * 1024 * 1024 * 1024
			long threshold = 10L * 1024 * 1024 * 1024;

			if (freeSpace < threshold)
			{
				return new CheckResult
				{
					Title = "C盘磁盘空间不足，请清理磁盘空间",
					Detail = $"剩余空间: {freeSpace / (1024 * 1024)} MB"
				};
			}
			else
			{
				return new CheckResult
				{
					Title = "C盘磁盘空间充足",
					Detail = $"剩余空间: {freeSpace / (1024 * 1024)} MB"
				};
			}
		}
	}
}
